The number and variety of wireless terminal devices, such as mobile telephones, personal computers and PDAs with wireless communication capabilities, self-service kiosks and two-way pagers are rapidly increasing. Software applications which run on these devices increase their utility. For example, a mobile phone may include an application which retrieves the weather for a range of cities, or a PDA may include an application that allows a user to shop for groceries. These software applications take advantage of wireless connectivity to a data network (such as the Internet) in order to provide timely and useful services to users.
Referring to FIG. 1, a network facilitating the use of software-driven wireless terminal devices generally comprises an Application Gateway (AG) 2 coupled between a wireless network 4 and a data network 6, such as for example, the internet; and one or more wireless terminal devices 8 coupled to the wireless network 4, and hosted by the AG 2.
The AG 2 generally operates to mediate message flows between the terminal devices 8 and data services 10 accessible through the data network in the manner described in Applicant's co-pending U.S. Patent Publications Nos. 2004/0215700 and 2004/0220998, the contents of both of which are incorporated herein by reference.
In general, the terminal devices 8 can be any of a wide variety of software-controlled wireless devices including, but not limited to, mobile telephones, personal computers and PDAs with wireless communication capabilities, self-service kiosks and two-way pagers. As is well known in the art, such devices generally comprise a microprocessor which operates under software control to provide the functionality of the terminal device 8.
As described in Applicant's co-pending U.S. Patent Publications Nos. 2004/0215700 and 2004/0220998, operation of the AG 2 enables a wireless application executing in a terminal device 8 to communicate with Web services 10 offered through the data network 6. This operation may, for example, including accessing HTML content and downloading files from back-end data sources (not shown) connected to the data network 6. In order to reduce device resource requirements, each wireless application provides User Interface (UT) functionality (for both display and user input) appropriate to the capabilities of the particular terminal device 8. At least a portion of the application logic is executed on the AG 2, so that signalling between the AG 2 and the terminal device 8 is limited to downloading application data for local storage and display on the terminal device 8, and uploading user inputs. The application logic executing on the AG 2 communicates with a Web service 10 or back-end data source (not shown) on the data network 6, in response to the user input received from the terminal device 8, to provide the functionality of the wireless application. This arrangement enables a user of the terminal device 8 to access and use the Web service 10, but with reduced signalling traffic to/from the terminal device 8 to thereby limit wireless network bandwidth and device resource requirements.
As will be appreciated, instantiation of data components of an application during runtime is governed by relationships between different components, called “inheritance” (or “prototyping”) and “aggregation”. These are also known in the art as “is-a” and “has-a” relationships, respectively. The former refers to one component A being a specialization of another component B. The latter refers to one component C having as part of it another component D. When either relationship exists, the instantiation of one component invokes the instantiation of another component. Component A cannot be instantiated until component B has. Component C cannot be instantiated until component D has.
A malicious programmer may try to define these relationships in such a way that infinite loops are created when instantiating components on the device. Such infinite loops may cause device lock-ups, application crashes and saturation of resources such as memory, so they are undesirable. Furthermore, a programmer may inadvertently and without malice create such relationships and unknowingly deploy equally undesirable wireless applications.
In practice, two main types of relationships should be avoided. The first is a “direct” recursive loop such as that illustrated in FIG. 2a. A direct recursive loop occurs when a set of data components are defined, and the aggregation relationships between these components set up a closed loop. The Example of FIG. 2a shows a recursive loop of three components. As shown in FIG. 2a, when data component A is instantiated, it will try to instantiate Data B. When Data B is instantiated, it will try to instantiate Data C. But when Data C is instantiated it will try to instantiate Data A. Thus an infinite recursive loop of component instantiations is set up, which will continue until all memory on the terminal device has been consumed.
In languages like Java and C++, the above-described recursive relationship can be created dynamically in the following manner:                class A        {                    B b=new B ( );                        }        class B        {                    C c=new C ( );                        }        class C        {                    A a=new A( );                        }        
With this situation, creating an instance of any of classes A, B or C (during runtime) will cause the application to loop recursively, creating ever-deeper nesting of objects a, b and c until the host computer's stack overflows or memory runs out. Conventional compilers and runtime systems provide no mechanisms that prevent the programmer from creating these kinds of recursive loops.
The second relationship type is more subtle. Because data components allow inheritance, it is possible to create a situation where a recursive loop is created indirectly. Such an “indirect” recursive loop is illustrated in FIG. 2b. In this case, when Data A is instantiated, it will try to instantiate Data B. However, Data B is linked to Data C by inheritance, so instantiation of Data B also instantiates Data C. But when Data C is instantiated, it will try to instantiate Data A, and the recursive loop is established. Here again, conventional compilers and runtime systems provide no mechanism to stop the programmer from creating these kinds of recursive loops.
Existing systems that allow initialization of data leave it to the programmer to avoid both of the above situations. However this arrangement is not acceptable on wireless devices, because a provider of wireless services may be held responsible for the behaviour of applications created by third-party application developers who are outside of the service provider's control.
Accordingly, methods and systems for enforcing safe component relationships in wireless applications remain highly desirable.